Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IIFE example to JSX documentation #4144

Merged
merged 1 commit into from
Jul 13, 2015
Merged

Add IIFE example to JSX documentation #4144

merged 1 commit into from
Jul 13, 2015

Conversation

lukehorvat
Copy link
Contributor

Resolves #4141.

@zpao
Copy link
Member

zpao commented Jul 13, 2015

Thanks!

zpao added a commit that referenced this pull request Jul 13, 2015
Add IIFE example to JSX documentation
@zpao zpao merged commit 4d17841 into facebook:master Jul 13, 2015
zpao added a commit that referenced this pull request Jul 17, 2015
Add IIFE example to JSX documentation
(cherry picked from commit 4d17841)
@geoyws
Copy link

geoyws commented Sep 6, 2016

{() => {
    switch (this.state.color) {
        case "red":   return "#FF0000";
        case "green": return "#00FF00";
        case "blue":  return "#0000FF";
        default:      return "#FFFFFF"; 
    }
}()}

This doesn't work. You have to wrap the arrow function in parens as per the docs:

{(() => {
    switch (this.state.color) {
        case "red":   return "#FF0000";
        case "green": return "#00FF00";
        case "blue":  return "#0000FF";
        default:      return "#FFFFFF"; 
    }
})()}

@lukehorvat
Copy link
Contributor Author

This doesn't work.

@geoyws It's been fixed for some time now, mate. See #4471.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants